#include<iostream>
#include<vector>
using namespace std;

class Solution {
public:
    void moveZeroes(vector<int>& nums) {
        int des=-1;
        int cur=0;
        // 双指针
        while(cur<nums.size())
        {
            if(nums[cur] != 0)
            {
				std::swap(nums[++des],nums[cur]);
            }
            cur++;
        }
    }
};

int main()
{
	vector<int> nums{0,1,0,3,12};
	

	Solution s;
	s.moveZeroes(nums);
	
	for(int e : nums)
	{
		cout << e << " ";
	}
	
	cout << "\n";
	return 0;
}

